<?php ini_set("memory_limit","32M"); ?>
<script type="text/javascript">
		function report_pdf(){		      
 
            var site 		= "<?php echo site_url()?>";
			var periode		= "<?php echo $periode;?>";
			var kode_wil	= "<?php echo $kode_wil;?>";
			var jenis_kb	= "<?php echo $jenis_kb;?>";
			
			var buat_nama 	= document.getElementById('buat_nama').value;
			var buat_nip 	= document.getElementById('buat_nip').value;
			var buat_jabatan 	= document.getElementById('buat_jabatan').value;
			
			var periksa_nama 	= document.getElementById('periksa_nama').value;
			var periksa_nip 	= document.getElementById('periksa_nip').value;
			var periksa_jabatan 	= document.getElementById('periksa_jabatan').value;
			
			
			var ketahui_nama 	= document.getElementById('ketahui_nama').value;
			var ketahui_nip 	= document.getElementById('ketahui_nip').value;
			var ketahui_jabatan 	= document.getElementById('ketahui_jabatan').value;
			
			var kirim = buat_nama+'~'+buat_nip+'~'+buat_jabatan+'~'+periksa_nama+'~'+periksa_nip+'~'+periksa_jabatan+'~'+ketahui_nama+'~'+ketahui_nip+'~'+ketahui_jabatan;
			//alert (kirim);
			//document.forms["myform"].submit();
			location.href = site+'/piutang_pajak_per_kb/report_pdf_langsung/'+periode+'/'+kode_wil+'/'+jenis_kb+'/'+kirim; 

		}
	</script>

 
<link href="<?=base_url()?>asset/admin/css/style.css" rel="stylesheet" type="text/css">

			<div id="tab-settings" class="tabs-content"> 
			 <!--<form name="myform" action="<?=base_url()?>/index.php/piutang_pajak_per_wilayah/report_pdf_langsung">-->
			 <?
				//$attributes = array('name' => 'myform', 'id' => 'myform', 'class'=>'block-content form');
				//echo form_open_multipart('piutang_pajak_per_wilayah/report_pdf_langsung', $attributes);
			?>	
				<div class="colx3-left" style="margin-top:10px;">
					<label for="complex-en-url"><b>Dibuat Oleh  :</b></label>
					<p> 
						<span class="relative">
							<br/><label for="complex-en-url">Nama (*) :</label>
							<br/><input type="text" name="buat_nama" id="buat_nama"   value="" class="duapertiga-width">
						</span>

						<span class="relative">
							<br/><label for="complex-en-url">NIP (*) :</label>
							<br/><input type="text" name="buat_nip" id="buat_nip"   value="" class="duapertiga-width">
						</span>

						<span class="relative">
							<br/><label for="complex-en-url">Jabatan (*) :</label>
							<br/><input type="text" name="buat_jabatan" id="buat_jabatan"   value="" class="duapertiga-width">
						</span>	
					</p>
				</div  >
				<div  class="colx3-center" style="margin-top:10px;">
					<label for="complex-en-url"><b>Diperiksa Oleh  :</b></label>
					<p> 
						<span class="relative">
							<br/><label for="complex-en-url">Nama (*) :</label>
							<br/><input type="text" name="periksa_nama" id="periksa_nama"   value="" class="duapertiga-width">
						</span>

						<span class="relative">
							<br/><label for="complex-en-url">NIP (*) :</label>
							<br/><input type="text" name="periksa_nip" id="periksa_nip"   value="" class="duapertiga-width">
						</span>

						<span class="relative">
							<br/><label for="complex-en-url">Jabatan (*) :</label>
							<br/><input type="text" name="periksa_jabatan" id="periksa_jabatan"   value="" class="duapertiga-width">
						</span>	
					</p>
				</div>
				<div  class="colx3-right" style="margin-top:10px;">
					<label for="complex-en-url"><b>Diketahui Oleh  :</b></label>
					<p> 
						<span class="relative">
							<br/><label for="complex-en-url">Nama (*) :</label>
							<br/><input type="text" name="ketahui_nama" id="ketahui_nama"   value="" class="duapertiga-width">
						</span>

						<span class="relative">
							<br/><label for="complex-en-url">NIP (*) :</label>
							<br/><input type="text" name="ketahui_nip" id="ketahui_nip"   value="" class="duapertiga-width">
						</span>

						<span class="relative">
							<br/><label for="complex-en-url">Jabatan (*) :</label>
							<br/><input type="text" name="ketahui_jabatan" id="ketahui_jabatan"   value="" class="duapertiga-width">
						</span>	
					</p>
				</div>	
					
					<br/><button type="submit" onclick="report_pdf()"><img src="<?=base_url()?>asset/admin/images/icons/fugue/tick-circle.png" width="16" height="16">REKAP PDF</button>
			<!-- </form>		--> 
			</div>	


<div id="div_laporan">

	<table class="laporan" width="90%" border="1">
<thead>
		<tr><td colspan="12"><b>Dinas Pendapatan Daerah Provinsi Kalimantan Timur</b></td></tr>

		<tr><td colspan="12"><b>JL. Mayjen M.T Haryono Samarinda</b></td></tr>

		<tr><td colspan="12"><b>TELP </b></td></tr>

		<tr><td colspan="12"><b></b><br/></td></tr>

		<tr><td colspan="12" div align="center"><b>LAPORAN PIUTANG PAJAK PER KENDARAAN BERMOTOR</b></td></tr>

		<tr><td colspan="12"><b>Periode : <?=$periode?></b></td></tr>

		<tr><td colspan="12"><b>Wilayah : <?=$kode_wil?> - <?=$kode_wilvalue?></b></td></tr>
		
		<tr><td colspan="12"><b>Jenis Kendaraan : <?=$jenis_kb?> - <?=$jenis_kbvalue?></b></td></tr>
		
					
					<tr> 
						<!--<th align="left" valign="top" scope="col">&nbsp;</th>-->
						<th width="46" rowspan="2" align="center" valign="middle" scope="col">Nomor</th>
						<th width="300" rowspan="2" align="left" valign="middle" scope="col">NAMA /<br />
					  ALAMAT</th>
						<th width="75" rowspan="2" align="left" valign="middle" scope="col">WILAYAH</th>
						<th width="300" rowspan="2" align="left" valign="middle" scope="col">DETAIL KENDARAAN BERMOTOR </th>
						
						<th width="61" align="center" valign="middle" scope="col" colspan="2">PKB </th>
						<th width="64" align="center" valign="middle" scope="col" colspan="2">PKB TUNGGAKAN</th>
					  <th width="107" align="center" valign="middle" scope="col" colspan="2">SWDKLLJ</th>
					  <th width="107" align="center" valign="middle" scope="col" colspan="2">SWDKLLJ TUNGGAKAN</th>
				  <tr> 
						<!--<th align="left" valign="top" scope="col">&nbsp;</th>-->
						<th width="61" align="left" valign="middle" scope="col">POKOK </th>
						<th width="64" align="left" valign="middle" scope="col">DENDA </th>
					  <th width="107" align="left" valign="middle" scope="col"> TUNGGAKAN </th>
					  <th width="107" align="left" valign="middle" scope="col"> DENDA </th>
						<th width="83" align="left" valign="middle" scope="col">SWDKLLJ </th>
						<th width="80">
					     DENDA </th> 
						<th width="152" align="left" valign="middle" scope="col">TUNGGAKAN</th>
						<th width="107">
				      DENDA </th>
				  </tr>
				</thead>
				
				<tbody>
					
					<?php 
					$i=0;
					$j=0;
					$sum_pkb_pok = 0;
					$sum_pkb_den = 0; 
					$sum_pkb_tgk = 0; 
					$sum_pkb_tgk_den = 0;
					$sum_swdkllj_pok = 0;
					$sum_swdkllj_den = 0;
					$sum_swdkllj_tgk =0;
					$sum_swdkllj_tgk_den =0;
					$sum_sisa = 0; 
				//	$row = $getItemCount->num_rows();
					
					foreach($getItemCount->result() as $row) {$j=$j+1; } 
					$getItemCount = $j;
					//echo $getItemCount; echo '<<'; echo '<br/>';
					
					
					for($x=0;$x<=$getItemCount-1;$x++){
					
					$i = $i+1;
					//foreach($piutang->result() as $row1)echo $row1->piutang;echo'<br/>';echo'<br/>';
					//foreach($sudah_bayar->result_array() as $row2) echo $row2[1]['sudah_bayar'];echo'<br/>';
					
					$row1 = $results->result_array(); 
						//echo $x.'-'. $row1[$x]['kd_wilayah'].'-'.$row1[$x]['nm_wilayah'].'-'.$row1[$x]['kd_jenis_kb'].'-'.$row1[$x]['uraian'];  
					$row2 = $piutang->result_array(); 
						//echo $x.'-'. $row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'.$row2[$x]['piutang'];  
					$row3 = $sudah_bayar->result_array();
						//echo $x.'-'. $row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'. $row3[$x]['sudah_bayar'];echo'<br/>'; 
					
					?>
					<tr >
						<td align="left" valign="top"><?=$i ?> </td>
						<td align="left" valign="top"><?=$row1[$x]['nm_pemilik'];?>
					    /<br /> <?=$row1[$x]['al_pemilik'];?> </td>
						<td align="left" valign="top"><?=$row1[$x]['kd_wilayah'];?> - <?=$row1[$x]['nm_wilayah'];?> </td>
						<td align="left" valign="top"><?=$row1[$x]['no_polisi'];?> - <?=$row1[$x]['merk'];?>- <?=$row1[$x]['model'];?> - <?=$row1[$x]['warna'];?> - <?=$row1[$x]['cc'];?></td>
						<td align="right" valign="top"><?=/*$row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'.*/convert_rupiah_non_rp($row1[$x]['pkb_pok']);?></td>
						<td align="right" valign="top"><?=/*$row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'.*/convert_rupiah_non_rp($row1[$x]['pkb_den']);?></td>
			<td align="right" valign="top"><?=/*$row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'.*/convert_rupiah_non_rp($row1[$x]['pkb_tgk']);?>
			  <br /></td><td align="right" valign="top"><?=/*$row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'.*/convert_rupiah_non_rp($row1[$x]['pkb_tgk_den']);?></td>
			  <td align="right" valign="top"><?=/*$row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'.*/convert_rupiah_non_rp($row1[$x]['swdkllj_pok']);?>			  </td>
			  <td align="right" valign="top">
			  <?=/*$row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'.*/convert_rupiah_non_rp($row1[$x]['swdkllj_den']);?></td>
			  <td align="right" valign="top">
			  <?=/*$row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'.*/convert_rupiah_non_rp($row1[$x]['swdkllj_tgk']);?> </td>
			  <td align="right" valign="top">
			  <?=/*$row2[$x]['kd_wilayah'].'-'.$row2[$x]['kd_jenis_kb'].'-'.*/convert_rupiah_non_rp($row1[$x]['swdkllj_tgk_den']);?></td>
						<!--<td align="right" valign="top"><?=convert_rupiah_non_rp(($row2[$x]['pkb_pok']-$row1[$x]['swdkllj_pok']));?> </td>-->
					</tr>	
					<?
						$sum_pkb_pok = $sum_pkb_pok + $row1[$x]['pkb_pok']; 
						$sum_pkb_den = $sum_pkb_den + $row1[$x]['pkb_den'];
						$sum_pkb_tgk = $sum_pkb_tgk + $row1[$x]['pkb_tgk'];
						$sum_pkb_tgk_den = $sum_pkb_tgk_den + $row1[$x]['pkb_tgk_den']; 
						$sum_swdkllj_pok = $sum_swdkllj_pok + $row1[$x]['swdkllj_pok'];
						$sum_swdkllj_den = $sum_swdkllj_den + $row1[$x]['swdkllj_den'];
						$sum_swdkllj_tgk = $sum_swdkllj_tgk + $row1[$x]['swdkllj_tgk'];
						$sum_swdkllj_tgk_den = $sum_swdkllj_tgk_den + $row1[$x]['swdkllj_tgk_den'];
						$sum_sisa = $sum_sisa + ($row1[$x]['pkb_pok']-$row3[$x]['sudah_bayar']); 
					}
					?>
					<tr>
							<td colspan="3"><b>JUMLAH : </b></td> 
							<td></td>
							<td align="right"><b><?=convert_rupiah_non_rp($sum_pkb_pok);?> </b></td><td>
							<b> <?=convert_rupiah_non_rp($sum_pkb_den);?></b></td>
							<td align="right"><b><?=convert_rupiah_non_rp($sum_pkb_tgk);?><br />
				      </b></td><td align="right"><b><?=convert_rupiah_non_rp($sum_pkb_tgk_den);?></b></td>
							<td align="right"><b><?=convert_rupiah_non_rp($sum_swdkllj_pok);?><br />
				      </b></td><td align="right" ><b>
						    <?=convert_rupiah_non_rp($sum_swdkllj_den);?></b></td>
							<td align="right"><b><?=convert_rupiah_non_rp($sum_swdkllj_tgk);?></b></td>
							<td align="right"><b>
													    <?=convert_rupiah_non_rp($sum_swdkllj_tgk_den);?></b></td>
							<!--td align="right"><b><?=convert_rupiah_non_rp($sum_sisa);?></b></td-->
				  </tr>	
					  
						<tr>
							<td colspan="6">&nbsp;</td>
						</tr>	
				</tbody>			
			 	 
	</table>

</div>  